/* 
 *  MHEG-5 Engine (ISO-13522-5)
 *  Copyright (C) 2007 Jason Leonard
 * 
 *  Work based on libmythfreemheg part of mythtv (www.mythtv.org)
 *  Copyright (C) 2004 David C. J. Matthews
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version 2
 *  of the License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *  Or, point your browser to http://www.gnu.org/copyleft/gpl.html
 *
 */
using System;
using System.Collections.Generic;
using System.Text;

namespace MHEG
{
    class MHTimer
    {
        private int m_nIdentifier;
        private long m_nPosition;
        private bool m_bAbsolute;

        public MHTimer(int nId, long nPosition, bool bAbsolute)
        {
            m_nIdentifier = nId;
            m_nPosition = nPosition;
            m_bAbsolute = bAbsolute;
        }

        public int Identifier
        {
            get
            {
                return m_nIdentifier;
            }
        }

        public long Position
        {
            get
            {
                return m_nPosition;
            }
            set
            {
                m_nPosition = value;
            }
        }

        public bool IsAbsolute
        {
            get
            {
                return m_bAbsolute;
            }
        }

        public TimeSpan PositionTimeSpan
        {
            get
            {
                return getMillisecondsTimeSpan(m_nPosition);
            }
        }

        public static TimeSpan getCurrentTimeSpan()
        {
            return new TimeSpan(DateTime.Now.Ticks);
        }

        public static TimeSpan getMillisecondsTimeSpan(long nMillis)
        {
            return TimeSpan.FromMilliseconds(nMillis);
        }
    }
}
